package cn.gson.work.model.service;

import cn.gson.work.model.mapper.DossierMapper;
import cn.gson.work.model.mapper.TfilMapper;
import cn.gson.work.model.mapper.TfilesMapper;
import cn.gson.work.model.pojos.Tfil;
import cn.gson.work.model.pojos.Tfiles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
public class TfilesService {
    @Autowired
    TfilesMapper fm;
    @Autowired
    TfilMapper tfm;
    @Autowired
    DossierMapper dm;
    public List<Tfiles> findTfiles(String fid,String fname,String fsecurity,String fborrower){
        return fm.findTfiles(fid,fname,fsecurity,fborrower);
    }
    public void addTfiles(Tfiles tfiles){
        fm.addTfiles(tfiles);
    }
    public void editTfiles(Tfiles tfiles){
        fm.editTfiles(tfiles);
    }
    public void delTfiles(int fno) {
        Tfiles tf= fm.findTfilesByNo(fno);
        fm.delTfiles(fno);
        Tfil t=new Tfil();
        t.setFname(tf.getFname());
        t.setDossier(tf.getDossier());
        t.setFid(tf.getFid());
        t.setFsecurity(tf.getFsecurity());
        t.setFstate("已销毁");
        tfm.addTfil(t);
    }
}
